Skip to content

Complete Claude 4.6 support alignment with compatibility aliases#21413

Closed
PeterDaveHello wants to merge 1 commit intoBerriAI:mainfrom
PeterDaveHelloKitchen:fix/complete-sonnet-opus-4-6-support
Closed

Complete Claude 4.6 support alignment with compatibility aliases#21413
PeterDaveHello wants to merge 1 commit intoBerriAI:mainfrom
PeterDaveHelloKitchen:fix/complete-sonnet-opus-4-6-support

Conversation

@PeterDaveHello
Copy link
Copy Markdown
Contributor

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have Added testing in the tests/litellm/ directory, Adding at least 1 test is a hard requirement - see details
  • My PR passes all unit tests on make test-unit
    • make test-unit run hit a local litellm_enterprise editable-install mismatch (not related to this PR's changes). Focused validation tests passed: 123 passed.
  • My PR's scope is as isolated as possible, it only solves 1 specific problem
  • I have requested a Greptile review by commenting @greptileai and received a Confidence Score of at least 4/5 before requesting a maintainer review

CI (LiteLLM team)

CI status guideline:

  • 50-55 passing tests: main is stable with minor issues.
  • 45-49 passing tests: acceptable but needs attention
  • <= 40 passing tests: unstable; be careful with your merges and assess the risk.
  • Branch creation CI run
    Link:

  • CI run for the last commit
    Link:

  • Merge / cherry-pick CI run
    Links:

Type

🐛 Bug Fix
✅ Test

Changes

  • Align Claude 4.6 model handling in Anthropic transformation logic:
    • recognize Sonnet 4.6 aliases (sonnet-4-6, sonnet_4_6, sonnet-4.6)
    • recognize dotted Opus 4.6 aliases (opus-4.6)
    • map reasoning_effort to adaptive thinking for Sonnet 4.6 (matching Opus 4.6 behavior)
    • keep output_config.effort=max restricted to Opus 4.6
  • Align Bedrock Claude 4.6 regional model entries with canonical IDs while preserving compatibility aliases:
    • Opus 4.6: include jp and apac, and keep au alias for compatibility
    • Sonnet 4.6: include canonical jp and keep apac alias for compatibility
  • Keep model price maps in sync:
    • model_prices_and_context_window.json
    • litellm/model_prices_and_context_window_backup.json
  • Extend and minimally adjust focused tests:
    • tests/litellm/llms/anthropic/test_anthropic_reasoning_effort.py
    • tests/test_litellm/llms/anthropic/chat/test_anthropic_chat_transformation.py
    • tests/test_litellm/test_claude_opus_4_6_config.py

Validation run

Executed:

poetry run pytest tests/litellm/llms/anthropic/test_anthropic_reasoning_effort.py tests/test_litellm/llms/anthropic/chat/test_anthropic_chat_transformation.py tests/test_litellm/test_claude_opus_4_6_config.py

Result:

123 passed

@vercel
Copy link
Copy Markdown

vercel bot commented Feb 17, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
litellm Ready Ready Preview, Comment Feb 18, 2026 0:59am

Request Review

@PeterDaveHello
Copy link
Copy Markdown
Contributor Author

@greptileai

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Feb 17, 2026

Greptile Summary

This PR extends Claude 4.6 support by adding Sonnet 4.6 model detection and wiring it into the existing Anthropic transformation logic. Key changes:

  • Adds _is_claude_sonnet_4_6() helper for detecting Sonnet 4.6 model aliases (sonnet-4-6, sonnet_4_6, sonnet-4.6)
  • Adds dotted alias opus-4.6 to the existing Opus 4.6 detector
  • Maps reasoning_effort to adaptive thinking for Sonnet 4.6, matching Opus 4.6 behavior
  • Adds Sonnet 4.6 aliases to the native structured output (output_format) model list
  • Correctly keeps effort='max' restricted to Opus 4.6 only
  • Adds Bedrock regional entries (jp., apac.) for Opus 4.6 and Sonnet 4.6 in both pricing JSON files
  • Extends tests thoroughly covering adaptive thinking, effort validation, and structured output for all new aliases

Confidence Score: 4/5

  • This PR is safe to merge — it adds model aliases and routing logic with good test coverage and no behavioral regressions.
  • The changes are well-scoped, follow existing patterns in the codebase, and include thorough test coverage (123 tests passing per the author). The transformation logic correctly restricts effort='max' to Opus 4.6 only while extending adaptive thinking to Sonnet 4.6. One minor style inconsistency noted in the response_format model list (underscore aliases only added for 4.6, not retroactively for 4.5), but this is pre-existing and low-risk.
  • litellm/llms/anthropic/chat/transformation.py — core logic changes for model detection and routing.

Important Files Changed

Filename Overview
litellm/llms/anthropic/chat/transformation.py Adds _is_claude_sonnet_4_6 helper and wires Sonnet 4.6 into adaptive thinking and native structured output paths. Correctly restricts effort='max' to Opus 4.6 only. Adds underscore aliases for 4.6 models in response_format model set.
model_prices_and_context_window.json Adds jp. and apac. regional entries for Opus 4.6 and jp. for Sonnet 4.6. Pricing and capabilities match existing regional entries for these models.
litellm/model_prices_and_context_window_backup.json Backup file kept in sync with main model prices JSON. Same regional entries added.
tests/litellm/llms/anthropic/test_anthropic_reasoning_effort.py Adds tests for Opus 4.6 dotted alias and Sonnet 4.6 adaptive thinking. All mock-only tests, no network calls.
tests/test_litellm/llms/anthropic/chat/test_anthropic_chat_transformation.py Extends structured output and effort validation tests to cover Sonnet 4.6. Adds test for reasoning_effort adaptive mapping for Sonnet 4.6. All tests are properly mocked.
tests/test_litellm/test_claude_opus_4_6_config.py Updates region validation test to expect jp. and apac. entries in addition to existing au. alias. Adds Sonnet 4.6 regional registration assertions.

Flowchart

flowchart TD
    A[incoming model string] --> B{_is_claude_opus_4_6?}
    A --> C{_is_claude_sonnet_4_6?}
    
    B -->|Yes| D[adaptive thinking]
    C -->|Yes| D
    B -->|No| E{other reasoning model?}
    C -->|No| E
    E -->|Yes| F[budget-based thinking]
    E -->|No| G[no thinking param]

    A --> H{response_format check}
    H -->|model matches 4.5/4.6 set| I[native output_format]
    H -->|other model| J[tool-based workaround]

    A --> K{output_config.effort == max?}
    K -->|Yes| B2{_is_claude_opus_4_6?}
    B2 -->|Yes| L[allow max effort]
    B2 -->|No| M[raise ValueError]
    K -->|No| N[allow effort value]
Loading

Last reviewed commit: 0bfd2b0

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

6 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0bfd2b0b44

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +729 to +730
AnthropicConfig._is_claude_opus_4_6(model)
or AnthropicConfig._is_claude_sonnet_4_6(model)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Allow reasoning_effort for dotted Claude 4.6 aliases

This adds dotted alias handling to _map_reasoning_effort, but the normal completion flow validates params against get_supported_openai_params() before this mapping runs, and that list only includes reasoning_effort when supports_reasoning(model) is true. Because the Anthropic model map does not include claude-opus-4.6* / claude-sonnet-4.6* keys, those aliases still fail support detection and reasoning_effort is rejected as unsupported in utils._check_valid_arg, so the new dotted-alias reasoning mapping is unreachable in production requests.

Useful? React with 👍 / 👎.

Align Claude Sonnet 4.6 and Opus 4.6 support with official Anthropic
and Bedrock model behavior while preserving existing caller
compatibility.

Update Anthropic transformation logic to recognize Sonnet 4.6 and
dotted Opus 4.6 aliases in reasoning and structured output handling.
Keep effort=max restricted to Opus 4.6 only.

Align Bedrock regional mappings to include canonical regional IDs and
keep legacy aliases to avoid breaking existing integrations:
- Opus 4.6: keep jp/apac canonical coverage and preserve au alias
- Sonnet 4.6: keep jp canonical and preserve apac alias

Keep test changes minimal by extending existing Claude 4.6 config tests
with only required assertions for new aliases and regional parity.
@PeterDaveHello
Copy link
Copy Markdown
Contributor Author

Close due to #21448, opened a new #21487 to replace this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant